<template>
  <el-row class="data-view" type="flex" justify="space-between">
    <div class="item" v-for="(item, index) in data" :key="index">
      <div class="label">
        {{ item.label }}
      </div>
      <el-row type="flex" justify="space-between" align="middle">
        <div>{{ item.subLabel }}</div>
        <div class="value">
          <span>{{ item.value }}</span>
          {{ item.unit }}
        </div>
      </el-row>
      <el-row type="flex" justify="space-between" align="middle">
        <div>年度目标</div>
        <div class="value">
          <span class="yellow">{{ item.target }}</span>
          {{ item.unit }}
        </div>
      </el-row>
    </div>
  </el-row>
</template>

<script>
export default {
  name: "DataView",
  data() {
    return {
      data: [
        {
          label: "利润总额",
          subLabel: "本年累计",
          value: 0.19,
          target: 0.44,
          unit: "亿",
        },
        {
          label: "项目落地数量",
          subLabel: "本年累计",
          value: 0,
          target: 3,
          unit: "个",
        },
        {
          label: "净资产收益率",
          subLabel: "当年实际",
          value: 4.06,
          target: 10.16,
          unit: "%",
        },
        {
          label: "自定义指标",
          subLabel: "当年实际",
          value: "-",
          target: "-",
          unit: "%",
        },
      ],
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.data-view {
  .item {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 240px;
    height: 170px;
    padding: 12px 0 12px 20px;
    background: linear-gradient(90deg, #122d56 0%, #0e203e 100%);
    .label {
      position: relative;
      font-size: 16px;
      font-weight: bold;
      color: #ffffff;
      line-height: 19px;
      &::before {
        position: absolute;
        bottom: -6px;
        left: 0;
        content: "";
        width: 217px;
        height: 2px;
        background: linear-gradient(
          270deg,
          rgba(19, 50, 108, 0),
          rgba(56, 164, 249, 1)
        );
      }
    }
    .value {
      padding-right: 25px;
      span {
        font-size: 24px;
      }
    }
  }
}
</style>
